#include <iostream>

using namespace std;

class Solution {
   private:
    string reverseWord(string s, int start, int end) {
        while (start <= end && start < s.size() && end >= 0) {
            char tmp = s[start];
            s[start++] = s[end];
            s[end--] = tmp;
        }
        return s;
    }

   public:
    string reverseLeftWords(string s, int n) {
        s = reverseWord(s, 0, n - 1);
        s = reverseWord(s, n, s.size() - 1);
        s = reverseWord(s, 0, s.size() - 1);
        return s;
    }
};

int main() {
    string s = Solution().reverseLeftWords("abcdefg", 2);
    cout << s;
    return 0;
}